<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Example: DataTable - Nested Headers (YUI Library)</title>
<link type="text/css" rel="stylesheet" href="../../build/reset/reset.css">
<link type="text/css" rel="stylesheet" href="../../build/fonts/fonts.css">
<link type="text/css" rel="stylesheet" href="../../build/logger/assets/logger.css">
<link type="text/css" rel="stylesheet" href="../../build/datatable/assets/datatable.css">
<link type="text/css" rel="stylesheet" href="./css/examples.css">
<link type="text/css" rel="stylesheet" href="../assets/dpSyntaxHighlighter.css">
<style type="text/css">
/* custom css*/
#nested {margin:1em;}
#nested table {border-collapse:collapse;}
#nested th, #nested td {border:1px solid #000;padding:.25em;}
#nested th {background-color:#696969;color:#fff;}/*dark gray*/
#nested .yui-dt-odd {background-color:#eee;} /*light gray*/
</style>
</head>
<body>
<div id="hd">
    <h1><img src="./img/logo.gif" class="logo" alt="Y!"/><a href="./">DataTable Widget</a> :: Nested Headers</h1>
</div>
<div id="bd">
    <div id="nested"></div>

    <!-- Sample code begins -->
    <div id="code">
        <h3>Sample Code</h3>

        <p>Data:</p>

        <textarea name="code" class="JScript" cols="60" rows="1">
YAHOO.example.Data.webstats = [
    ["home.html",20,400,44,657],
    ["blog.html",24,377,97,567],
    ["contact.html",32,548,42,543],
    ["about.html",8,465,12,946]
];
        </textarea>

        <p>CSS:</p>

        <textarea name="code" class="HTML" cols="60" rows="1">
/* custom css*/
#nested {margin:1em;}
#nested table {border-collapse:collapse;}
#nested th, #nested td {border:1px solid #000;padding:.25em;}
#nested th {background-color:#696969;color:#fff;}/*dark gray*/
#nested .yui-dt-odd {background-color:#eee;} /*light gray*/
        </textarea>

        <p>Markup:</p>

        <textarea name="code" class="HTML" cols="60" rows="1">
<div id="nested"></div>
        </textarea>

        <p>JavaScript:</p>

        <textarea name="code" class="JScript" cols="60" rows="1">
var myColumnHeaders = [
    {key:"page", text:"Page"},
    {text:"Statistics", type:"number", children:[
        {text:"Visits",
            children: [
                {key:"visitsmonth", text:"This Month"},
                {key:"visitsytd", text:"YTD", abbr:"Year to Date"}
            ]
        },
        {text:"Views",
            children: [
                {key:"viewsmonth", text:"This Month"},
                {key:"viewsytd", text:"YTD", abbr:"Year to Date"}
            ]

        }
    ]}
];

var myColumnSet = new YAHOO.widget.ColumnSet(myColumnHeaders);

var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.webstats);
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
myDataSource.responseSchema = {
    fields: ["page","visitsmonth","visitsytd","viewsmonth","viewsytd"]
};

var myDataTable = new YAHOO.widget.DataTable("nested", myColumnSet, myDataSource,{caption:"Example: Nested Headers"});
        </textarea>
    </div>
    <!-- Code sample ends -->
</div>

<script type="text/javascript" src="../../build/yahoo/yahoo.js"></script>
<script type="text/javascript" src="../../build/dom/dom.js"></script>
<script type="text/javascript" src="../../build/event/event.js"></script>
<script type="text/javascript" src="../../build/logger/logger.js"></script>
<script type="text/javascript" src="../../build/datasource/datasource-beta-debug.js"></script>
<script type="text/javascript" src="../../build/datatable/datatable-beta-debug.js"></script>
<script type="text/javascript" src="./js/data.js"></script>
<script type="text/javascript">
var myLogger = new YAHOO.widget.LogReader();

/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
var myColumnHeaders = [
    {key:"page", text:"Page",sortable:true},
    {text:"Statistics", type:"number", children:[
        {text:"Visits",
            children: [
                {key:"visitsmonth", text:"This Month",sortable:true},
                {key:"visitsytd", text:"YTD", abbr:"Year to Date",sortable:true}
            ]
        },
        {text:"Views",
            children: [
                {key:"viewsmonth", text:"This Month",sortable:true},
                {key:"viewsytd", text:"YTD", abbr:"Year to Date",sortable:true}
            ]

        }
    ]}
];

var myColumnSet = new YAHOO.widget.ColumnSet(myColumnHeaders);

var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.webstats);
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
myDataSource.responseSchema = {
    fields: ["page","visitsmonth","visitsytd","viewsmonth","viewsytd"]
};

var myDataTable = new YAHOO.widget.DataTable("nested", myColumnSet, myDataSource,{caption:"Example: Nested Headers"});
</script>
<script type="text/javascript" src="../assets/dpSyntaxHighlighter.js"></script>
<script type="text/javascript">
dp.SyntaxHighlighter.HighlightAll('code');
</script>
</body>
</html>
